import React,{Component} from 'react';
import Tabbar from './components/tabbar/Tabbar';
import {HashRouter as Router,Route,Switch,Redirect} from 'react-router-dom';

import Home from './components/home/Home';
import Category from './components/category/Category';
import Buy from './components/buy/Buy';
import Car from './components/car/Car';
import Personal from './components/personal/Personal';

import SearchWrap from './components/searchWrap/SearchWrap';
import GoodList from './components/goodList/GoodList';

import OrderDetils from './components/orderDetails/OrderDetils';
import Login from './components/login/login';
import User from './components/user/user';

import GoodDetail from './components/gooddetail/GoodDetail';
import Register from './components/register/register';



function App() {
  return (
    <div>
     <Router>
       <Switch>
         <Route exact path="/home" render={(props)=><Tabbar {...props}><Home></Home></Tabbar>}></Route>
         <Route exact path="/category" render={(props)=><Tabbar {...props}><Category></Category></Tabbar>}></Route>
         <Route exact path="/buy" render={(props)=><Tabbar {...props}><Buy></Buy></Tabbar>}></Route>
         <Route exact path="/car" render={(props)=><Tabbar {...props}><Car></Car></Tabbar>}></Route>
         <Route exact path="/personal" render={(props)=><Tabbar {...props}><Personal></Personal></Tabbar>}></Route>
 
         <Route exact path="/search" render={(props)=><SearchWrap></SearchWrap>}></Route>
         <Route exact path="/goodlist" render={(props)=><GoodList></GoodList>}></Route>

         <Route exact path="/orderDetils" render={(props) => <OrderDetils {...props}></OrderDetils>}></Route>
         <Route exact path="/login" render={(props) => <Tabbar {...props}><Login></Login></Tabbar>}></Route>
         <Route exact path="/user" render={(props) => <Tabbar {...props}><User></User></Tabbar>}></Route>
         <Route exact path="/register" render={(props) => <Register></Register>}></Route>
         <Route exact path="/goodDetail/:goods_id" render={(props) => <GoodDetail></GoodDetail>}></Route>


         <Redirect to="/home"></Redirect>
       </Switch>
     </Router>
    </div>
  );
}

export default App;
